﻿@model TCC.CMFlow.Models.GrupoAprovacao

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

<div class="panel panel-info" style="margin-top: 15px">
    <div class="panel-heading clearfix">

        <h3 class="panel-title pull-left"><strong>Grupo de Aprovação</strong></h3>
        <div class="pull-right">
            @Html.ActionLink("Editar", "Edit", new { id = Model.ID }, new { @class = "btn btn-primary", id = "btnEdit", data_modal = "" })
            @Html.ActionLink("Listar Grupos", "Index", null, new { @class = "btn btn-default" })
        </div>

    </div>
    <div class="panel-body">

        <div>
            <dl class="dl-horizontal">
                <dt>
                    @Html.DisplayNameFor(model => model.Nome)
                </dt>

                <dd>
                    @Html.DisplayFor(model => model.Nome)
                </dd>

                <dt>
                    @Html.DisplayNameFor(model => model.Descricao)
                </dt>

                <dd>
                    @Html.DisplayFor(model => model.Descricao)
                </dd>

            </dl>
        </div>

        <div class="panel panel-primary">
            <div class="panel-heading clearfix">
                <h3 class="panel-title pull-left"><strong>Usuários Aprovadores</strong></h3>
                <div class="btn-group pull-right">
                    <a data-modal="" class="btn btn-primary btn-xs" href="@Url.Action("AdicionarUsuario", new { id = Model.ID })" id="btnAdicionar"><span class="glyphicon glyphicon-plus"></span> Adicionar Usuário</a>
                </div>
            </div>
            @*<div class="panel-body"></div>*@
            <table class="table table-striped table-bordered">
                <tr>
                    <th>
                        Nome
                    </th>
                    <th>
                        E-mail
                    </th>
                    <th>
                        Ação
                    </th>
                </tr>

                @foreach (var item in Model.Usuarios)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.Nome)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Email)
                        </td>
                        <td>
                            <a href="@Url.Action("DeletarUsuario", new { id = Model.ID, grupoUsuarioId = item.Id })" id="btnDelete" class="btn" data-modal="" data-toggle="tooltip" data-placement="bottom" title="Desvincula o Usuário do Grupo"><span class="glyphicon glyphicon-trash"></span></a>
                        </td>
                    </tr>
                }
            </table>
        </div>

    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/modalform")
}
